package
{
	import mx.controls.TextArea;
	import mx.core.mx_internal;
	import mx.logging.targets.LineFormattedTarget;
	import mx.logging.LogEventLevel;
	
	use namespace mx_internal;
	
	public class LogTarget extends LineFormattedTarget
	{
		
		public function LogTarget(tarea:TextArea)
		{
			//TODO: implement function
			super();
			this.level = LogEventLevel.INFO;
			this.includeDate = true;
			this.includeLevel = true;
			this.includeTime = true;
			
			_textArea = tarea;
		} 
		
		private var _textArea:TextArea;
		
		/* 		 		
		Descendants of this class should override this method to direct the 
		specified message to the desired output.
		
		@param  message String containing preprocessed log message which may
		include time, date, category, etc. based on property settings,
		such as <code>includeDate</code>, <code>includeCategory</code>,
		etc.
		
		mx_internal function internalLog(message:String):void
		{
		// override this method to perform the redirection to the desired output
		} 
		*/
		
		mx_internal override function internalLog(message:String):void
		{
			_textArea.text += message + "\n";
		} 
	}
	
}